package ninja.awesome.game.gameobject;

import java.util.Random;

import ninja.awesome.framework.Graphics;
import ninja.awesome.framework.Image;
import ninja.awesome.game.MainGameScreen;
import ninja.awesome.game.main.Sprites;

public class Weather extends GameObj{

	private int speed = 10;
	private Image image;
	private Random gen;

	Sprites s;
	MainGameScreen game;


	public Weather(int x, int y, int num, Random gen, MainGameScreen game, Sprites s) {
		super(x,y);
		this.gen = gen;
		this.game= game;
		if (num == 1) {
			this.image = s.getWeatherSprite1();
		}
		if (num == 2) {
			this.image = s.getWeatherSprite2();
		}
		if (num == 3) {
            this.image = s.getWeatherSprite3();
		}
	}

	public void update() {
		xLoc -= speed;
		if (yLoc >= (MainGameScreen.HEIGHT * MainGameScreen.SCALE + 15)) {
			yLoc = -100;
			xLoc = Math.abs(gen.nextInt() % (MainGameScreen.WIDTH - 30));
		}
	}

	public void draw(Graphics g) {
		g.drawImage(image, xLoc, yLoc);
	}

	// GETTERS
	public int getX() {
		return xLoc;
	}

	public int getY() {
		return yLoc;
	}

	// Setters
	public void SetX(int x) {
		this.xLoc = x;
	}

	public void SetY(int y) {
		this.yLoc = y;

	}
}